package com.gitee.wsl.service.updown

import kotlin.jvm.JvmInline

sealed interface DownloadStatus {

    /**
     * Represents the progress of a download
     * @param totalBytesReceived The total bytes received
     * @param contentLength The total bytes to receive
     */
    //TODO: Replace with multi-field value class
    data class Progress(val totalBytesReceived: Long, val contentLength: Long) : DownloadStatus

    /**
     * Represents the success of a download
     */
    data object Success : DownloadStatus

    /**
     * Represents the data of a download. Only sent, when not streaming to a [ByteWriteChannel]
     * @param data The data of the download
     */
    @JvmInline
    value class ByteData(val data: ByteArray) : DownloadStatus

}